
        <html>
			<head>
			     <title>Dionaea蜜罐指南 - 我是壮丁</title>
				 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
			</head>
			<body>
				<h1>原文地址:<a href="http://drops.wooyun.org/papers/4584">http://drops.wooyun.org/papers/4584</a></h1>
				
      <p>
        <h1>0x00 前言</h1>

<hr />

<p>测试了一下dionaea这个蜜罐,算是一篇总结吧</p>

<h1>0x01 环境</h1>

<hr />

<p>CentOS release 6.2 (Final)</p>

<p>Linux www.centos.com 2.6.32-220.el6.x86&#95;64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86&#95;64 x86&#95;64 x86&#95;64 GNU/Linux</p>

<!--more-->

<h1>0x02 依赖性</h1>

<hr />

<p>libev >=4.04</p>

<p>libglib >=2.20</p>

<p>libssl</p>

<p>liblcfg</p>

<p>libemu</p>

<p>python >=3.2</p>

<p>sqlite >=3.3.6</p>

<p>readline >=3</p>

<p>cython >0.14.1</p>

<p>libudns</p>

<p>libcurl >=7.18</p>

<p>libpcap >=1.1.1</p>

<p>libnl(可选,不加也没啥影响)</p>

<p>libgc >=6.8</p>

<h1>0x03 安装</h1>

<hr />

<pre><code>#!bash
mkdir /opt/dionaea
yum install git autoconf* libtool-*
</code></pre>

<h2>liblcfg</h2>

<pre><code>#!bash
git clone git://git.carnivore.it/liblcfg.git liblcfg
cd liblcfg/code
autoreconf -vi
./configure --prefix=/opt/dionaea
make install
</code></pre>

<h2>libemu</h2>

<pre><code>#!bash
git clone git://git.carnivore.it/libemu.git libemu
cd libemu
autoreconf -vi
./configure --prefix=/opt/dionaea
make install
</code></pre>

<h2>libev</h2>

<pre><code>#!bash
wget http://dist.schmorp.de/libev/Attic/libev-4.04.tar.gz
tar xfz libev-4.04.tar.gz
cd libev-4.04
./configure --prefix=/opt/dionaea
make install
</code></pre>

<h2>Python 3.2</h2>

<pre><code>#!bash
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
wget http://www.python.org/ftp/python/3.2.2/Python-3.2.2.tgz
tar xfz Python-3.2.2.tgz
cd Python-3.2.2/
./configure --enable-shared --prefix=/opt/dionaea --with-computed-gotos --enable-ipv6 LDFLAGS="-Wl,-rpath=/opt/dionaea/lib/ -L/usr/lib/x86_64-linux-gnu/"
make
make install
</code></pre>

<h2>Cython</h2>

<pre><code>#!bash
wget http://cython.org/release/Cython-0.15.tar.gz
tar xfz Cython-0.15.tar.gz
cd Cython-0.15
/opt/dionaea/bin/python3 setup.py install
</code></pre>

<h2>udns</h2>

<pre><code>#!bash
wget http://www.corpit.ru/mjt/udns/old/udns_0.0.9.tar.gz
tar xfz udns_0.0.9.tar.gz
cd udns-0.0.9/
./configure
make shared
cp udns.h /opt/dionaea/include
cp *.so* /opt/dionaea/lib/
cd /opt/dionaea/lib
ln -s libudns.so.0 libudns.so
</code></pre>

<h2>libpcap</h2>

<pre><code>#!bash
wget http://www.tcpdump.org/release/libpcap-1.1.1.tar.gz
tar xfz libpcap-1.1.1.tar.gz
cd libpcap-1.1.1
./configure --prefix=/opt/dionaea
make
make install
</code></pre>

<h2>libcurl</h2>

<pre><code>#!bash
#可以源码编译,也可以直接安装
git clone https://github.com/bagder/curl.git curl
cd curl
autoreconf -vi
./configure --prefix=/opt/dionaea
make
make install
</code></pre>

<h2>dionaea</h2>

<pre><code>#!bash
#nl模块会出问题,各种问题....
#实在不行/usr/include/netlink/netlink.h,mv到其他目录,
#安装好了再复原了
git clone git://git.carnivore.it/dionaea.git dionaea
cd dionaea
autoreconf -vi
./configure --with-lcfg-include=/opt/dionaea/include/ \
      --with-lcfg-lib=/opt/dionaea/lib/ \
      --with-python=/opt/dionaea/bin/python3.2 \
      --with-cython-dir=/opt/dionaea/bin \
      --with-udns-include=/opt/dionaea/include/ \
      --with-udns-lib=/opt/dionaea/lib/ \
      --with-emu-include=/opt/dionaea/include/ \
      --with-emu-lib=/opt/dionaea/lib/ \
      --with-gc-include=/usr/include/gc \
      --with-ev-include=/opt/dionaea/include \
      --with-ev-lib=/opt/dionaea/lib \
      --with-curl-config=/usr/bin/ \
      --with-pcap-include=/opt/dionaea/include \
      --with-pcap-lib=/opt/dionaea/lib/ 
make
make install
</code></pre>

<p>创建指定特定的用户和组,用来运行dionaea</p>

<pre><code>#!bash
groupadd dionaea
useradd -g dionaea -s /usr/sbin/nologin dionaea
chown -R dionaea:dionaea /opt/dionaea/
</code></pre>

<p>运行测试,没报错,使用netstat -antple 看到好多dionaea开放的端口,证明安装成功</p>

<pre><code>#!bash
cd /opt/dionaea/bin
./dionaea -c /opt/dionaea/etc/dionaea/dionaea.conf -u dionaea -g dionaea
</code></pre>

<p><img src="http://static.wooyun.org/drops/20150113/2015011307493258759image001.png" alt="enter image description here" /></p>

<h1>0x04 图形化</h1>

<hr />

<h2>Python 2.7</h2>

<pre><code>#!bash
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar -Jxvf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --with-threads --enable-shared --prefix=/usr/local
make
make altinstall
ln -s /usr/local/lib/libpython2.7.so.1.0 /lib64/
</code></pre>

<h2>pip</h2>

<pre><code>#!bash
wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
tar zxvf distribute-0.6.49.tar.gz
cd distribute-0.6.49
python2.7 setup.py install
easy_install-2.7 pip
</code></pre>

<h2>django</h2>

<pre><code>#!bash
pip2.7 install Django pygeoip django-pagination django-tables2 django-compressor 
django-htmlmin django-filter
wget https://github.com/benjiec/django-tables2-simplefilter/archive/master.zip -O 
django-tables2-simplefilter.zip
unzip django-tables2-simplefilter.zip
mv django-tables2-simplefilter-master/ 
django-tables2-simplefilter/
cd django-tables2-simplefilter/
python2.7 setup.py install
</code></pre>

<p>python-netaddr</p>

<pre><code>#!bash
wget https://pypi.python.org/packages/source/n/netaddr/netaddr-0.7.11.tar.gz
tar xzvf netaddr-0.7.11.tar.gz
cd netaddr-0.7.11
python2.7 setup.py install
</code></pre>

<h2>PySubnetTree</h2>

<pre><code>#!bash
git clone git://git.bro-ids.org/pysubnettree.git
cd pysubnettree/
python2.7 setup.py install
</code></pre>

<h2>Nodejs</h2>

<pre><code>#!bash
wget http://nodejs.org/dist/v0.8.16/node-v0.8.16.tar.gz
tar xzvf node-v0.8.16.tar.gz
cd node-v0.8.16
./configure
make
make install
npm install -g less

cd /opt/
wget https://github.com/RootingPuntoEs/DionaeaFR/archive/master.zip -O DionaeaFR.zip
unzip DionaeaFR.zip
mv DionaeaFR-master/ DionaeaFR
</code></pre>

<h2>GeoIP&amp;&amp;GeoLiteCity</h2>

<pre><code>#!bash
cd /opt/DionaeaFR/DionaeaFR/static
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
</code></pre>

<p>运行图形界面</p>

<pre><code>#!bash
cd /opt/DionaeaFR/
python2.7 manage.py collectstatic #type yes when asked
</code></pre>

<p>可能提示要运行一次python manage.py migrate, 提示就运行一次,有时候报错,但是好像不影响使用..........</p>

<pre><code>#!bash
python2.7 manage.py runserver 0.0.0.0:8000
Validating models...
</code></pre>

<h1>0x05 debug</h1>

<hr />

<p>更改时区,默认是美国的</p>

<pre><code>settings.py
TIME_ZONE = 'Asia/Shanghai'
</code></pre>

<p>更改时间格式,一直没有生效,不知道是为啥</p>

<p>访问web的时候</p>

<pre><code>Error: Cannot find module 'promise'
</code></pre>

<p>运行</p>

<pre><code>npm install -g promise
</code></pre>

<p>访问DionaeaFR的GRAPHS页面报</p>

<pre><code>TypeError: __init__() got an unexpected keyword argument 'mimetype'
</code></pre>

<p>修改/opt/DionaeaFR/Web/views/graph.py，</p>

<p>mimetype="application/json"全部修改成</p>

<p>content_type="application/json"。</p>

<p>访问http://ip:8000</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011307572869991image003.png" alt="enter image description here" /></p>

<p>Nessus扫描</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011307575770242image005.png" alt="enter image description here" /></p>

<p>主机识别的结果</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011307582777946image007.png" alt="enter image description here" /></p>

<h1>0x06 结构</h1>

<hr />

<h2>命令格式</h2>

<hr />

<p>Dionaea 具体的命令格式如下：</p>

<pre><code>dionaea [-c, --config=FILE] [-D, --daemonize] [-g, --group=GROUP]
        [-h, --help] [-H, --large-help][-l, --log-levels=WHAT] [-L, --log-domains=WHAT]    
        [-u, --user=USER][-p, --pid-file=FILE] [-r, --chroot=DIR] [-V, --version]
        [-w, --workingdir=DIR]
</code></pre>

<p>选项的意义分别是： -c：指定运行程序所使用的配置文件，默认下配置文件是/opt/dionaea/etc/dionaea.conf。 -D：后台运行。 -g：指定启动后切换到某个用户组，默认下保持当前组。 -h：帮助信息。 -H：帮助信息，包括默认值信息。 -l：选择事件记录级别，可以选择 all, debug, info, message, warning, critical, error 这些值，多选使用“,”做分隔，排除使用“-”。 -L：选择域，支持通配符“*”和“?”，多选使用“,”，排除使用“-”。 -u：指定启动后切换到某个用户，默认下保持当前用户。 -p：记录 pid 到指定文件。 -r：指定启动后切换根目录到指定目录，默认下不切换。 -V：显示版本信息。 -w：设定进程工作目录，默认下为/opt/dionaea。</p>

<p>例子:</p>

<pre><code>dionaea -l all,-debug -L '*'
dionaea -l all,-debug -L 'con*,py*'
dionaea -u nobody -g nogroup -w /opt/dionaea -p /opt/dionaea/var/run/dionaea.pid
</code></pre>

<h2>配置文件</h2>

<hr />

<p>默认配置文件/opt/dionaea/etc/dionaea/dionaea.conf</p>

<p>里面包含以下几个模块</p>

<p>logging: 普通日志和错误日志存放的位置,等级和所属的域.</p>

<p>processors: 处理器 processors 部分配置 libemu 和用于导出数据流的模块 streamdumper. libemu 部分可增减允许的协议,配置 shellcode 检测时支持的最大流大小、跟踪步数限制和并发执行数等性能参数。streamdumper 部分配置导出数据流时允许和拒绝的协议,数据流保存的位置。</p>

<p>downloads: 文件下载保存的位置 bistreams: 配置数据流保存的位置 submit: 指定恶意文件自动提交的网址 listen: 指定监听的IP和接口</p>

<pre><code>    一共有三种模式:

    getifaddrs:对所有的ip上都开启相关端口的监听,127.0.0.1也会监听,默认的选项
    manual:只在指定ip上开启端口监听
    nl:指定监听的接口
    配置子接口,一个网卡上多个IP被监测

listen =
{
        mode = "manual"
        addrs = { eth0 = ["10.1.2.3", "11.1.2.3"]}
}
</code></pre>

<p>modules: 配置各种模块的工作参数.部分"必须模块": curl、libemu、pcap模拟的服务等信息</p>

<pre><code>    pcap:用来拒绝连接的请求.

    curl:用来传输文件,下载文件或者向第三方站点提交样本

    emu:用来检测或者模拟shellcode执行

    python:被dionaea调用,来模拟服务
</code></pre>

<h1>0x07 端口指纹信息修改</h1>

<hr />

<p>提供以下这些服务</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308030947544image009.png" alt="enter image description here" /></p>

<p>nmap -sV端口识别,信息太明显,显示" Dionaea honeypot"等字样</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308034361799image011.png" alt="enter image description here" /></p>

<p>修改配置文件,变更指纹信息 SMB的445端口指纹: /opt/dionaea/lib/dionaea/python/dionaea/smb/include/smbfields.py 中</p>

<pre><code>MConditionalField(UnicodeNullField("OemDomainName", "WORKGROUP")
ConditionalField(UnicodeNullField("ServerName", "HOMEUSER-3AF6FE")
</code></pre>

<p>WORKGROUP和HOMEUSER-3AF6FE,变更信息</p>

<p>MSSQL的1433端口指纹: /opt/dionaea/lib/dionaea/python/dionaea/mssql/mssql.py的 r.VersionToken.TokenType = 0x00修改为0xAA</p>

<p>FTP的21端口指纹: /opt/dionaea/lib/dionaea/python/dionaea/ftp.py self.reply(WELCOME&#95;MSG, "Welcome to the ftp service") 修改为 self.reply(WELCOME&#95;MSG, "Welcome to the svn service")</p>

<p>识别为正常的服务</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308050639292image013.png" alt="enter image description here" /></p>

<h1>0x08 通过uwsgi+nginx来发布页面</h1>

<hr />

<h2>配置uwsgi</h2>

<hr />

<p>安装pip</p>

<pre><code>#!bash
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
</code></pre>

<p>安装uwsgi</p>

<pre><code>#!bash
export LDFLAGS="-Xlinker --no-as-needed"
pip install uwsgi
</code></pre>

<p>测试uwsgi是否安装成功</p>

<pre><code>#!bash
vim test.py

# test.pydef application(env, start_response):    start_response('200 OK', [('Content-Type','text/html')])    return "Hello World"
</code></pre>

<p>执行shell命令</p>

<pre><code>#!bash
uwsgi --http :8001 --wsgi-file test.py
</code></pre>

<p>访问http://ip:8001是否有Hello World</p>

<h2>配置django</h2>

<hr />

<p>编辑django_wsgi.py</p>

<pre><code>#!python
# coding: utf-8
import os
import sys
reload(sys)
sys.setdefaultencoding('utf8')
</code></pre>

<p>需要修改的</p>

<pre><code>#!python
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
#from django.core.handlers.wsgi import WSGIHandler
#application = WSGIHandler()

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DionaeaFR.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
</code></pre>

<p>连接django和uwsgi</p>

<pre><code>#!bash
uwsgi --http :8000 --chdir /opt/DionaeaFR --module django_wsgi
</code></pre>

<p>访问http://ip:8000,可以看到项目</p>

<p>编写配置文件,来运行uWSGI</p>

<pre><code>#!html
vim /opt/DionaeaFR/djangochina_socket.xml

&lt;uwsgi&gt;
        &lt;socket&gt;127.0.0.1:9001&lt;/socket&gt;
        &lt;chdir&gt;/opt/DionaeaFR/&lt;/chdir&gt;
        &lt;module&gt;django_wsgi&lt;/module&gt;
        &lt;processes&gt;1&lt;/processes&gt; &lt;!-- 进程数 --&gt;
        &lt;daemonize&gt;/opt/DionaeaFR/var/uwsgi.log&lt;/daemonize&gt;
        &lt;pidfile&gt;/opt/DionaeaFR/var/uwsgi.pid&lt;/pidfile&gt;
&lt;/uwsgi&gt;
mkdir /opt/DionaeaFR/var/
</code></pre>

<h2>配置nginx</h2>

<hr />

<pre><code>location / {             include        uwsgi_params;            uwsgi_pass     127.0.0.1:8077;        }
</code></pre>

<p>配置目录,要不然css这些就没有了</p>

<pre><code>location /static/ {
alias /opt/DionaeaFR/static/;
        }
</code></pre>

<p>重新载入nginx配置文件</p>

<pre><code>nginx -s reload
</code></pre>

<p>运行uwsgi</p>

<pre><code>cd /opt/DionaeaFR
uwsgi -x djangochina_socket.xml
</code></pre>

<p>4.简单的控制脚本</p>

<pre><code>#!bash
UWSGI='/usr/local/bin/uwsgi'
UWSGIPID='/opt/DionaeaFR/var/uwsgi.pid'
UWSGIXML='/opt/DionaeaFR/djangochina_socket.xml'
KILL='/bin/kill'
RM='/bin/rm'


#start
start() {
                if [ -f $UWSGIPID ]
                then
                        echo "uwsgi has running"
                        return 1
                fi
                $UWSGI -x $UWSGIXML
                echo "uwsgi have running"
                return 0
        }

#stop
stop() {
                if [ ! -f $UWSGIPID ]
                then
                        echo "uwsgi not running"
                        return 1
                fi
                $KILL -HUP `cat $UWSGIPID` &amp;&amp; $RM -f $UWSGIPID
                if [ $? -eq 0 ]
                then
                        echo "uwsgi is stop"
                        return 0
                fi   
                echo "uwsgi stop fail"
                return 1
        }
#status
status() {
                if [ -f $UWSGPID ]
                then
                        echo "running"
                        return 0
                fi
                echo "not running"
                return 0
        }

#see how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status
        ;;
  *)
        echo "Usage: dionaea {start|stop}"
Esac
</code></pre>

<h1>0x09 后记</h1>

<hr />

<p><a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="6f8deff38ad1ee88fbc78deff28bd5e98af0d58ae0e42f8acbc586f7dc86cce188f5eb191f1c">[email&#160;protected]</a><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script>,收集了一些数据,这个比ssh的蜜罐多了太多!!!!!</p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308113236733image015.png" alt="enter image description here" /></p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308115488874image0071.png" alt="enter image description here" /></p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308122036420image019.png" alt="enter image description here" /></p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308130870663image021.png" alt="enter image description here" /></p>

<p><img src="http://static.wooyun.org/drops/20150113/2015011308134195515image023.png" alt="enter image description here" /></p>

<p>有大量的恶意程序,有兴趣的可以私信我啊~~~</p>

<p>最后给team的博客打个广告,大家手下留情........ http://www.sigma.ws/</p>

<p>参考:</p>

<p>http://takahoyo.hatenablog.com/entry/2014/05/26/023409</p>

<p>http://takahoyo.hatenablog.com/entry/2014/06/07/233059</p>

<p>http://bruteforce.gr/visualizing-dionaeas-results-with-dionaeafr.html</p>

<p>http://dionaea.carnivore.it/</p>

<p>http://rubenespadas.github.io/DionaeaFR/</p>

<p>http://www.freebuf.com/articles/system/12696.html</p>

<p>http://www.securityartwork.es/2014/06/05/avoiding-dionaea-service-identification/?lang=en</p>

<p>Dionaea低交互式蜜罐介绍.pdf</p>      </p>
    
			</body>
		</html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          